package com.design.editor;

public class Test {


    public static void main(String[] args) {
        DraftsBox draftsBox = new DraftsBox();
        Editor editor = new Editor("数据库备份 ，支持多数据库，清理过期备份数据", "执行以下脚本文件进行数据库备份，会当前目录下创建mysql文件夹进行备份操作", "https://img2023.cnblogs.com/blog/485422/202307/485422-20230715075445613-541019404.png");
        ArticleMemento articleMemento = editor.saveToMemento();
        draftsBox.addMemento(articleMemento);

        System.out.println("标题：" + editor.getTitle() + "\n" +
                "内容：" + editor.getContent() + "\n" +
                "插图：" + editor.getImgs());


        System.out.println("================首次修改文章================");
        System.out.println("完整的信息：" + editor);
        editor.setTitle("Centos7 环境数据库备份 ，支持多数据库，清理过期备份数据");
        editor.setContent("执行以下脚本文件进行数据库备份");
        System.out.println("================首次修改文章完成================");
        System.out.println("修改后文章：" + editor);

        System.out.println("================第1次撤销================");
        ArticleMemento menmento = draftsBox.getMenmento();
        editor.undoFromMemento(articleMemento);
        System.out.println("完整信息：" + editor);
        System.out.println("===========第1次撤销完成=============");
    }
}
